home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds / fscheck.man < prev    next >
Text File  |  1990-02-15  |  13KB  |  286 lines

  1. ' $Header: /sprite/src/cmds/fscheck/RCS/fscheck.man,v 1.6 89/08/25 22:24:31 jhh Exp $ SPRITE (Berkeley)
  2. .so \*(]ltmac.sprite
  3. .HS FSCHECK cmds
  4. .BS
  5. .SH NAME
  6. fscheck \- perform consistency check on file system
  7. .SH SYNOPSIS
  8. \fBfscheck -dev \fIdevice\fP -part \fIpartition\fP [\fIoptions\fR]
  9. .SH OPTIONS
  10. .IP "\fB\-dev\fI device\fR" 14
  11. \fIDevice\fP is the root name of a device, i.e. rxy0, rsd1, rsb0
  12. .IP "\fB\-part\fI partition\fR" 14
  13. \fIPartition\fP is a letter indicating a partition, i.e. a, b, c, d, e, f, g.
  14. .IP "\fB\-dir\fI devDir\fR" 14
  15. \fIDevDir\fR is an alternate directory in which to find the device file
  16. named by concatenating \fIDevice\fR and \fIPartition\fR.  The default 
  17. directory name is ``/dev/``.
  18. .IP "\fB\-initialPart\fI firstPartName\fR" 14
  19. \fIfirstPartName\fP is the name of the initial partition on the disk
  20. which contains basic disk geometry information.  The default is partition
  21. ``a''.
  22. .IP "\fB\-write\fR" 14
  23. Write the disk when errors are encountered and fixed.  The default is to
  24. not write the disk.
  25. .IP "\fB\-silent\fR" 14
  26. Don't say anything unless there is an error.
  27. .IP "\fB\-verbose\fR" 14
  28. Output verbose information about errors.  The default is to print out
  29. terse information.
  30. .IP "\fB\-incVersion\fR" 14
  31. If the domain was not written back properly on system shutdown then all
  32. version numbers will be incremented.
  33. .IP "\fB\-fixRoot\fR" 14
  34. Re-create a missing or corrupted root directory.
  35. .IP "\fB\-clear\fR" 14
  36. Clear the domain number field stored in the summary sector.
  37. .IP "\fB\-hostID\fI id\fR" 14
  38. Update the host ID in the disk header. If \fIid\fR is not 0 then it is used
  39. as the host id to put in the header. If \fIid\fR equals 0 then one of two
  40. values are used as the host id.  If the device server is the local host
  41. then the kernel's internal idea of its host id is used, otherwise the
  42. device server's id is used.
  43. .IP "\fB\-badBlock\fR" 14
  44. Initialize the bad block file descriptor.
  45. .IP "\fB\-outputFile\fI outputFile\fR" 14
  46. All output to stdout and stderr is also appended to 
  47. \fIoutputFile\fR. 
  48. .IP "\fB\-bufferSize\fI size\fR" 14
  49. Set the size of the buffer associated with \fIoutputFile\fR to \fIsize\fR bytes.
  50. Default is to use whatever buffer is provided by the stdio library.
  51. This option has no effect if the \fB\-outputFile\fR option is not used.
  52. .IP "\fB\-rootPart\fR" 14
  53. This option controls the output to a file. If the \fB\-outputFile\fR option
  54. is not given then this option has no effect. 
  55. Otherwise, the output is stored in a buffer and only written to the
  56. file when the program exits.
  57. This allows the output to be written to a file on the partition being checked
  58. (usually the output is written to the root partition).
  59. The file IO in this case is very primative and restrictive. The output file
  60. must be in the root directory and must exist prior to running \fBfscheck\fR.
  61. If the size of the output exceeds the size of the file or if it exceeds the
  62. size of the direct data blocks then it will be truncated. If the output
  63. exceeds the size of the internal buffer it will be truncated
  64. (see \fB\-bufferSize\fR ).
  65. If the output is smaller than the size of the file, the remaining part of
  66. the file will be filled with null characters.
  67. Any file produced by this option will have a decimal number in the first
  68. line which represents the number of bytes in the file. This is used by
  69. \fBfscheck\fR to calculate the starting point for appending.
  70. The output file can be reset by either setting the first number to 0 or by
  71. overwriting the file with null characters.
  72. .IP "\fB\-heapLimit\fI size\fR" 14
  73. Program will not allocate more than \fIsize\fR bytes of memory. Default is to 
  74. allocate as much as is needed.
  75. .IP "\fB\-delete\fR" 14
  76. If a data block is shared by more than one file, delete it from all but one
  77. of the files. The default is to make a copy of the block for each file
  78. sharing the original.
  79. .IP "\fB\-readBlock\fI count\fR" 14
  80. Read count blocks at a time when reading the file descriptors. 
  81. Currently this does not provide better performance due to limitations in the
  82. disk interface library.
  83. .IP "\fB\-debug\fR" 14
  84. Print out debugging information.
  85. .IP "\fB\-bitmapVerbose\fR" 14
  86. Print out lots and lots of information about errors in the bitmaps.
  87. .IP "\fB\-numReboot\fI count\fR" 14
  88. Number of consecutive times to reboot before returning a warning indication.
  89. .IP "\fB\-clearFixCount\fR" 14
  90. Clear consecutive fix counter.
  91. .BE
  92.  
  93. .SH DESCRIPTION
  94. .LP
  95. This program will perform a consistency check on a file system.  By default
  96. it will report inconsistencies but won't repair them.  If the \fB\-write\fP 
  97. option
  98. is used then it will repair any inconsistencies by modifying the disk as
  99. necessary.
  100. .LP
  101. This program performs the following consistency checks:
  102. .IP 1. 5
  103. It makes sure that the file descriptor allocation bit map agrees with the
  104. status information kept in each file descriptor.  If necessary it will correct
  105. the bit map.
  106. .IP 2. 5
  107. It confirms that data-block and indirect-block pointers are valid.  If a 
  108. pointer is invalid then the pointer is set to NIL and the file size is
  109. adjusted as necessary to reflect the new size of the file.
  110. .IP 3. 5
  111. It recreates the data block allocation bit map based on information in
  112. the file descriptors and indirect blocks.
  113. .IP 4. 5
  114. It checks for blocks that are allocated to more than one file.  
  115. If a block is multiply allocated then copies of the block are made and 
  116. all but one of 
  117. the files is corrected to use a copy.
  118. If the \fB\-delete\fR option is given, or if only a subset of the fragments in
  119. a block are shared, then the block is given to the 
  120. lowest numbered file
  121. descriptor and it is removed from all other files that reference it.
  122. A special case is made of block 0. This block belongs to the root directory
  123. and is copied (or deleted) for all other files even if the root directory
  124. is corrupted or doesn't exist.
  125. .IP 5. 5
  126. It verifies that directories are of the proper format.  In order to patch
  127. a directory, names may be deleted, the directory may be truncated,
  128. or in the worst case the directory may be turned into a normal file.
  129. .IP 6. 5
  130. It puts unreferenced files into the lost+found directory.  The name of each
  131. file in the lost+found directory is the file's file descriptor number.
  132. .IP 7. 5
  133. It corrects link counts and block counts in each file descriptor.
  134. .IP 8. 5
  135. It checks that indirect blocks contain valid pointers. If the pointers are
  136. invalid and the block is part of a file then a hole is created, 
  137. otherwise if the
  138. block is part of a directory then the directory is truncated.
  139. .IP 9. 5
  140. It checks that each file descriptor contains a valid magic number. If this is
  141. not the case then the file descriptor is cleared and marked as unused in the
  142. bitmap.
  143. .IP 10. 5
  144. It recreates the root directory if it is corrupted and the \fB\-fixRoot\fR
  145. option is given.
  146. .LP
  147. By default only terse information is given about the errors in the file system.
  148. Only the first error per file is reported.
  149. If the \fB\-verbose\fP 
  150. option is given then more verbose information will be given.
  151. If the \fB\-bitmapVerbose\fR option is given then differences between the
  152. bitmaps on disk and the recreated bitmaps are printed. Since the bitmaps
  153. on disk are not kept current use of this option is likely to produce 
  154. lots of output.
  155. .LP
  156. The \fBfscheck\fP program will also perform other actions depending on
  157. the options that are specified.  If the \fB\-incVersion\fP 
  158. option is given then flags
  159. in the file system header are checked to see if the file system
  160. was safely written back
  161. when it was detached or the system went down.  If it is determined that the
  162. file system was not safely written back then the version numbers for
  163. all files in the file system are incremented.  This will cause all
  164. reopens of files because of recovery to fail.
  165. .LP
  166. If the \fB\-fixRoot\fP option is given the root directory will
  167. be recreated if it has become corrupted.  If the root is recreated, then
  168. any directories that have the root directory as their parent
  169. will be inserted into the root with their file descriptor number
  170. as their name.
  171. Any files that used to be in the root directory will be placed in lost+found.
  172. \fBFscheck\fR assumes that data block 0 belongs to the root directory and
  173. will allocate this block to the directory when reconstructing it.
  174. The \fB\-fixRoot\fR option requires reading the root directory twice, hence
  175. it cannot be used without the \fB\-write\fR option.
  176. .LP
  177. The \fB\-clear\fP option should be used if the domain number field should be
  178. cleared from the summary sector.  Each file system that is attached is
  179. given a domain number under which it can be identified.
  180. When a file system is attached, the system will try to attach it with the same
  181. domain number that it was attached under last time.  This
  182. is required to allow clients of the file system to recover when the file
  183. system is reattached.  If the domain number field is cleared from the
  184. summary sector, then the system will attach the file system under a domain
  185. number of the system's choosing.
  186. .LP 
  187. The \fB\-hostID\fP option will force the system to update the host id in the
  188. file system header.  If the device under which the file system is being
  189. attached is generic then the id of the host on which \fBfscheck\fP is run is
  190. used.  Otherwise the host id specified by the device file is used.
  191. The default is not to modify the host id.
  192. .LP
  193. The \fB\-badBlock\fP 
  194. option will initialize the file descriptor which points
  195. to bad disk blocks.  Initializing it will clear out any pointers to bad
  196. blocks that are currently in the file descriptor.
  197. .LP
  198. The \fB\-heapLimit\fR option can be used to place an upper limit on the 
  199. size of the program heap. This can be used to prevent paging, since paging
  200. cannot be done at the point in the boot sequence when \fBfscheck\fR is run.
  201. If \fBfscheck\fR cannot 
  202. complete checking the disk because of the limit then it will
  203. do as much as it can. 
  204. This should allow multiple runs of \fBfscheck\fR to completely check the disk.
  205. The limit is only an approximation of how large \fBfscheck\fR will grow, since 
  206. the program stack is not restricted. Therefore the limit should be set as
  207. high as possible but it should not be set to the boundary at which
  208. paging will occur. 
  209. If it is set too small then \fBfscheck\fR may not be 
  210. able to run
  211. at all. Note that the \fBbufferSize\fR and \fBreadBlock\fR
  212. options will affect the amount of heap required.
  213. As a rule of thumb, the amount of heap space needed by \fBfscheck\fR 
  214. is proportional
  215. to the disk size and the amount of errors on the disk. 
  216. A heap limit of 1 Mb should be sufficient for all but the most extreme cases.
  217. .LP
  218. Each time \fBfscheck\fR runs and finds an error in a partition, a 
  219. counter on disk
  220. is incremented. The value of this counter is the number of consecutive
  221. times \fBfscheck\fR has run on the partition and corrected an error. 
  222. If the counter
  223. exceeds the value given by the \fB\-numReboot\fR option (default 4) and
  224. if \fBfscheck\fR corrects an error, then \fBfscheck\fR will return 
  225. EXIT_NOREBOOT
  226. instead of the standard soft error indication.
  227. This allows higher level software to avoid infinite reboot loops.
  228. .LP
  229. The \fB\-clearFixCount\fR option resets the consecutive counter to 0.
  230. .LP
  231. Finally, the \fB\-output\fR, \fB\-bufferSize\fR and \fB\-noFlush\fR options 
  232. control the output from fscheck. The \fB\-output\fR option
  233. allows the output from fscheck
  234. to be put into a file as well as printed on stdout and stderr.
  235. The \fB\-bufferSize\fR option sets the size of the IO buffer associated with 
  236. the output file.
  237. The \fB\-noFlush\fR option prevents the buffer from being flushed until the
  238. disk has been checked and corrected. 
  239. This allows the output to be written to the disk being checked.
  240. If the output exceeds the size of the buffer then it is truncated to the
  241. buffer size.
  242. If the buffer size is exceeded in the middle of an output string, then remainder
  243. of the string will wrap over the beginning of the buffer. 
  244. .SH EXIT CODES
  245. .LP 
  246. \fBFscheck\fR has a large number of exit codes. 
  247. Positive values indicate that some sort of error occurred that requires 
  248. \fBfscheck\fR be run again, although an exit code of 1 indicates that the
  249. filesystem was corrupted but was successfully corrected.
  250. Negative error codes indicate that a serious error occurred that requires
  251. user action before fscheck can be run again.
  252. .IP 0 5
  253. No errors occurred and no errors were fixed in the filesystem.
  254. .IP 1 5
  255. Errors were fixed in the filesystem.
  256. .IP 2 5
  257. \fBFscheck\fR ran out of memory before it was able to completely check the
  258. disk. Rerunning with the same heap limit should allow \fBfscheck\fR to finish.
  259. .IP 3 5
  260. Errors were fixed in the filesystem and the number of consecutive times
  261. \fBfscheck\fR has fixed this partition exceeds the limit.
  262. .IP -1 5
  263. An unspecified hard error occurred.
  264. .IP -2 5
  265. A disk read failed.
  266. .IP -3 5
  267. A disk write failed.
  268. .IP -4 5
  269. There was a problem with one of the arguments.
  270. .IP -5 5
  271. The heap limit is too small for \fBfscheck\fR to run. The heap limit must be
  272. made larger before rerunning \fBfscheck\fR.
  273. .IP -6 5
  274. The disk is full so that duplicate blocks cannot be copied. Either delete some
  275. stuff or rerun using the \fB\-delete\fR option.
  276. .LP 
  277. .SH BUGS/FEATURES
  278. .LP
  279. Indirect blocks are always marked as in use in the bitmap, even if they contain
  280. invalid entries. This is because the block may be in use by another file and
  281. cannot be marked as free.
  282. .LP
  283. The \fB\-fixRoot\fR option cannot be used without the \fB\-write\fR option.
  284. .SH KEYWORDS
  285. file system, disk
  286.